package com.gxitsky.async.design.controller;

import com.alibaba.fastjson.JSON;
import com.gxitsky.async.design.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;

/**
 * @author gxing
 * @desc 消息
 * @date 2022/7/28
 */
@RestController
@RequestMapping("/message")
public class MessageController extends BaseController {

    @Autowired
    private MessageService messageService;

    /**
     * @param servletRequest 请求
     * @desc 查详情
     * @author gxing
     * @date 2022/7/30 16:43
     */
    @GetMapping("/detail")
    public void detail(HttpServletRequest servletRequest) {
        handler(servletRequest, () -> messageService.detail());
    }

    /**
     * @param servletRequest 请求
     * @desc 查详情
     * @author gxing
     * @date 2022/7/30 16:43
     */
    @PostMapping("/receive")
    public void receive(@RequestBody HashMap<String, Object> map) {
        System.out.println(JSON.toJSON(map));
    }
}
